SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[DISC_DistOrderItemsInsert]
   	@DistID varchar(50),
	@PermID varchar(50),
	@OrderID nvarchar(50),
	@NetPrice decimal(18, 2),
	@DateTime datetime,
	@DownloadLink varchar(max),
	@GenerationStatus varchar(20),
	@GenerationError nvarchar(255),
	@MaxDownloads int,
	@StampVars nvarchar(max),
	@Promo nvarchar(255),
	@usersID nvarchar(255),
	@Password nvarchar(255) = null,
	@FileName nvarchar(255) = null
AS
BEGIN
	INSERT INTO [DISC_DistOrderItems]
	(
		DistID,
		PermID,
		OrderID,
		NetPrice,
		[DateTime],
		DownloadLink,
		GenerationStatus,
		GenerationError,
		MaxDownloads,
		StampVars,
		Promo,
		usersID,
		Password,
		FileName
	)
	VALUES
	(
		@DistID,
		@PermID,
		@OrderID,
		@NetPrice,
		@DateTime,
		@DownloadLink,
		@GenerationStatus,
		@GenerationError,
		@MaxDownloads,
		@StampVars,
		@Promo,
		@usersID,
		@Password,
		@FileName
	)

	SELECT SCOPE_IDENTITY()

END
GO
